Polygon3

data class Polygon3(val vertices: List<Vec3>, val precision: DoubleEquivalence = DEFAULT_DOUBLE_EQUIVALENCE) : Polygon<Vec3> (source)

Constructors

Link copied to clipboard
constructor(vertices: List<Vec3>, precision: DoubleEquivalence = DEFAULT_DOUBLE_EQUIVALENCE)

Properties

Link copied to clipboard
Link copied to clipboard

The normal vector of the polygon's plane.

Link copied to clipboard
Link copied to clipboard
open val vertexCount: Int

Returns the number of vertices in the polygon.

Link copied to clipboard
open override val vertices: List<Vec3>

Returns the list of vertices defining the polygon.

Functions

Link copied to clipboard
open override fun area(): Double

Computes the area of the polygon.

Link copied to clipboard
open override fun centroid(): Vec3

Computes the centroid (geometric center) of the polygon.

Link copied to clipboard
open override fun contains(point: Vec3): Boolean

Checks if a point is inside the polygon.

Link copied to clipboard
open override fun dimensions(): Int

Returns the number of dimensions of the spatial object.

Link copied to clipboard
open override fun isConvex(): Boolean

Checks if the polygon is convex.

Link copied to clipboard
open override fun isFinite(): Boolean

Returns true if all values in the spatial are finite.

Link copied to clipboard
open override fun isInfinite(): Boolean

Returns true if any value in the spatial is infinite.

Link copied to clipboard
open override fun isNaN(): Boolean

Returns true if any value in the spatial is NaN (Not a Number).

Link copied to clipboard
open override fun isSimple(): Boolean

Checks if the polygon is simple (non-self-intersecting).

Link copied to clipboard
open override fun perimeter(): Double

Computes the perimeter of the polygon.

Link copied to clipboard
open override fun reverse(): Polygon<Vec3>

Reverses the order of vertices, effectively reversing the orientation of the polygon.

Link copied to clipboard
open override fun scale(factor: Double, center: Vec3): Polygon<Vec3>

Scales the polygon by a given factor around a center point.

Link copied to clipboard
open override fun signedArea(): Double

Computes the signed area of the polygon.

Link copied to clipboard
open override fun transform(transformer: Transformer<Vec3>): Polygon<Vec3>

Transforms the polygon by applying a transformation to all vertices.

Link copied to clipboard
open override fun translate(offset: Vec3): Polygon<Vec3>

Translates the polygon by a given offset vector.